package org.HisCanvas.ChrisRiffle.JFlightLog.swingUi.table;


import java.text.DateFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;

import javax.swing.table.DefaultTableCellRenderer;


/**
 * 
 * 
 * @author rif 
 */
public class FlightTableDateCellRenderer extends DefaultTableCellRenderer {
	
			
	private static FlightTableDateCellRenderer INSTANCE;
	
	
	private DateFormat dateFormat;

	
	
	/**
	 * Default Constructor
	 */
	private FlightTableDateCellRenderer() {
	
		dateFormat = new SimpleDateFormat("mm/dd/yyyy");
	}
	
	
	/**
	 * singleton
	 * 
	 * @return
	 * 		singleton
	 */
	public static FlightTableDateCellRenderer instance() {
		
		if(INSTANCE == null){
			
			INSTANCE = new FlightTableDateCellRenderer();
		}
		return INSTANCE;
	}
	
	
	
	@Override
	protected void setValue(Object value) {		
		
		setText(value == null ? "" : dateFormat.format(value));
				
	}

}


